<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="{{ asset('/admins/css/bootstrap.min.css') }}" rel="stylesheet"> 
</head>
<body>
<table class="table table-bordered table-hover">
    <center><h2>轮播图管理</h2></center>
    <center><h6><a href="/admin/Carousel">浏览图片</a> / <a href="/admin/Carousel/create">添加图片</a></h6></center>
    @if(session('msg'))
        <div class="alert alert-success">{{ session('msg') }}</div>
    @endif
<div class="row-fluid">
    <form action="" method="post" name="myform">
        {{ csrf_field() }}
        {{ method_field('DELETE') }}
        <!-- <input type='hidden' name='_token' value='{{ csrf_token() }}'>
        <input type='hidden' name='_method' value='delete'> -->
    </form>
    <center>
    <form action='/admin/Carousel' method='get'>
        <div class='media-body'>
            <input type='text' class='col-lg-6' name='cImg'>
            <input type='submit' value='搜索图片'>
        </div>
    </form></center>
    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>ID</th>
                <th>图片名</th>
                <th>图片描述</th>
                <th>图片</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($list as $v)
              <tr>
                  <td>{{ $v->cId }}</td>
                  <td>{{ $v->cImg }}</td>
                  <td>{{ $v->cDescription }}</td>
                  <td><img style="width:50px;height:50px;" src="{{ asset('uploads/'.$v->cLinks) }}" /></td>
                  <td>
                    <a href="/admin/Carousel/{{ $v->cId }}/edit">修改</a> / 
                    <a href="javascript:doDel({{ $v->cId }})">删除</a>
                 </td>
              </tr>
           @endforeach
        </tbody>
    </table> 
    <center>{{ $list->appends($where)->links() }}</center>
</div>
<script type="text/javascript">
        function doDel(cId)
        {
            if(confirm('确定要删除吗？')){
                var form = document.myform;
                form.action = '/admin/Carousel/'+cId;
                form.submit();
            }
        }
    </script>
</body>
</html>     